import request from '@/utils/request'

export async function getAllCategoryOptions () {
  const result = await request.post('/admin/goods_category/list', {
    pageNo: 1,
    pageSize: 200
  }) || []
  return result.map(el => ({
    value: el.id,
    label: el.categoryName,
    children: el.childList ? el.childList.map((el) => ({
      value: el.id,
      label: el.categoryName,
    })) : null
  }))
}
